using System;

namespace GameKit.Core
{
    public interface IEntity
    {
        public string Name { get; set; }
        public bool Enabled { get; set; }
        T AddComponent<T>() where T : IComponent, new();
        T AddComponent<T>(T component) where T : IComponent;
        T AddComponent<T>(System.Type type, T component) where T : IComponent;
        void RemoveComponent<T>(T component) where T : IComponent;
        T GetComponent<T>() where T : class, IComponent;
        bool TryGetComponent<T>(out T component) where T : class, IComponent;
        T GetMonoBehaviour<T>() where T : class;
        bool TryGetMonoBehaviour<T>(out T component) where T : class;

        #region Events

        public void Register(string key, Action listener);
        public void Register<T>(string key, Action<T> listener);
        public void Unregister(string key, Action listener);
        public void Unregister<T>(string key, Action<T> listener);
        public void Unregister(string key);
        void Broadcast<T>(string key, T message);
        void Broadcast(string key);

        #endregion
    }
}